package xyc.szk.eljstl.pojo;


import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/*
 * 作者：zjLiu
 * 日期：2021-04-28
 * 公司：数学与计算机学院
 */
public class UsersTest {
    //@Test //junit测试
    public void test() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Users users = new Users(); //这就是一个javabean
        //users.setId("");
        users.setUserName("tom");
        users.setUserPwd("123");
        String id = BeanUtils.getProperty(users, "id1");
        String userName = BeanUtils.getProperty(users, "userName");
        String userPwd = BeanUtils.getProperty(users, "userPwd");
        System.out.println("users = " + users);
        System.out.println("id+userName+userPwd = " + id +"-"+ userName +"-"+ userPwd);
        BeanUtils.setProperty(users,"userName","张三");
        System.out.println("users = " + users);
       // BeanUtils.populate(users, map);

    }
}
